from typing import Union

from fastapi import FastAPI
from user import user_mysql_operate
app = FastAPI()

@app.get("/")
def read_root():
    return {"Hello": "World"}

@app.get("/user/{user_id}")
def read_user(user_id: int):
    print("进入路由")
    return user_mysql_operate.query_user_by(user_id)

# @app.get("/items/{item_id}")
# def read_item(item_id: int, q: Union[str, None] = None):
#     # return {"item_id": item_id, "q": q}
#     return user_mysql_operate.query_user_by(item_id)

# uvicorn main:app --reload